/* #include<iostream>
#include<vector>
#define N 100
using namespace std;
int count,n,m;//m是打印个数
int flag[N];
void dfs(int x){
	if(count==m||x==n){
		if(count==n)
		for(int i=0;i<x;i++){
			if(flag[i])
				cout<<i+1<<' ';
		}
		cout<<endl;
		return;
	}
	flag[x]=1;
	count++;
	dfs(x+1);
	flag[x]=0;
	count--;
	
	dfs(x);
}
int main(){
	cin>>n>>m;
	count=0;
	dfs(0);
} */
#include<iostream>
#include<vector>
#include<algorithm>
#define N 10000
using namespace std;
int n,m,counts;
vector<bool> flag;
void dfs(int x){
	if(counts==m||x==n){
		if(counts==m){
			for(int i=0;i<n;i++)
				if(flag[i])
					cout<<i+1;
		cout<<endl;}
		return ;	
	}
	flag[x]=1;
	counts=counts+1;
	dfs(x+1);
	flag[x]=0;
	counts=counts-1;
	dfs(x+1);
}

int main(){
	cin>>n>>m;
	counts=0;
	for(int i=0;i<n;i++)
		flag.push_back(0);
	dfs(0);
}